<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title></title>
    <link rel="stylesheet" href="../assets/css/layui.css">
    <link rel="stylesheet" href="../assets/css/view.css"/>
    <link rel="stylesheet" href="../assets/css/style.css"/>
</head>
<body class="layui-tank">
<div class="layui-card">
    <%
        Integer morningNum = (Integer)session.getAttribute("morningNum");
        Integer afternoonNum = (Integer)session.getAttribute("afternoonNum");
    %>
    <form class="layui-form" action="">
        <div class="layui-form-item">
            <label class="layui-form-label">上午预约人数</label>
            <div class="layui-input-block">
                <input type="text"  placeholder="<%=morningNum%>" class="layui-input" id="a">
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">下午预约人数</label>
            <div class="layui-input-block">
                <input type="text"  placeholder="<%=afternoonNum%>" class="layui-input" id="b">
            </div>
        </div>
    </form>
</div>
<div class=" tkbtnfxd">
    <button type="button" class="layui-btn  layui-btn-normal float-right" id="btn1">确定</button>
</div>

<script src="../assets/layui.all.js"></script>
<script src="../assets/jquery.min.js"></script>
<script type="text/javascript">
window.onload = function(){
    var aElt = document.getElementById("a");
    var bElt = document.getElementById("b");
    var btn1Elt = document.getElementById("btn1");
    btn1Elt.onclick = function(){
        var a = $("#a").val();
        var b = $("#b").val();
        if(a=="")
        {
            a = "<%=morningNum%>";
        }
        if(b=="")
        {
            b = "<%=afternoonNum%>";
        }
        $.ajax({
            url:"http://localhost:8080/websetdoctororder",
            type:"post",
            data:{morningNum:a,afternoonNum:b},
            dataType:"text",
            success:function(data){
                if(data=="True")
                {
                    alert("修改成功，请关闭本窗口")
                }
                else
                {
                    alert("修改失败");
                }
            },
            error:function(data){
                alert("Error");
            }
        });
    }
}
</script>
</body>
</html>
